部署网页

注意到运行完 gitbook serve 之后,目录下自动生成了 _book 目录,里面包含了生成网页的 html 代码。有两个办法在 GitHub 上 创建网页(本文采用部署到当前仓库)。

部署到新仓库

将 _book 作为新的仓库 push 到 GitHub 上,在仓库的 Settings > GitHub Pages 下选择 sourse 为 master branch 。

为了省事我写了个脚本:

  • update_book.sh
gitbook build
cd _book
rm .gitignore
git init
git remote add origin https://github.com/xxxxxxxxxxxx.git
git add .
git commit -m "update"
git push origin master -f
cd ..

部署到当前仓库

修改 _book 目录名为 docs ,在仓库的 Settings > GitHub Pages 下选择 sourse 为 master branch/docs folder 。

以后编写完文档后需要 先删除 原先的 docs 目录,运行 gitbook serve 之后将生成的 _book 目录改名为 docs

为了省事我又写了个脚本:

  • update_book.sh
rm -rf docs
gitbook build
mv _book docs
cd docs
rm update_book.sh
rm .gitignore
git add .
git commit -m "update web"
cd ..
git add .
git commit -m "update doc"
git push

results matching ""

    No results matching ""

    results matching ""

      No results matching ""